package model.card
{
	import flash.events.Event;
	import flash.events.EventDispatcher;
	
	import global.GameType;

	public class CardData extends EventDispatcher implements ICardData
	{
		private var _imageType:int;
		private var _value:int;
		private var _id:int;
		private var _state:int;
		private var _playState:int = GameType.CARD_PLAY_STATE_IN;
		private var _jokerValue:int = -1;
		
		public function CardData()
		{
		}

		public function get id():int
		{
			return _id;
		}

		public function set id(v:int):void
		{
			_id = v;
		}

		public function get value():int
		{
			return _value;
		}

		public function set value(v:int):void
		{
			_value = v;
		}

		public function get type():int
		{
			return _imageType;
		}

		public function set type(v:int):void
		{
			_imageType = v;
		}
		
		public function get state():int//是否 显示牌面
		{
			return _state;
		}
		
		public function set state(v:int):void
		{
			_state = v;
		}
		
		public function get playState():int//是否出牌
		{
			return _playState;
		}
		
		public function set playState(v:int):void
		{
			_playState = v;
			dispatchEvent(new Event(Event.CHANGE));
		}
		
		public function get jokerValue():int//是否由王变 
		{
			return _jokerValue;
		}
		public function set jokerValue(v:int):void
		{
			_jokerValue = v;
			if (_jokerValue != -1)
			{
				_value = v;
			}
		}
		
		public function clone():ICardData
		{
			var cardData:ICardData = new CardData();
			cardData.id = _id;
			cardData.value = _value;
			cardData.playState = _playState;
			cardData.state = _state;
			cardData.jokerValue = _jokerValue;
			cardData.type = _imageType;
			return cardData;
		}
	}
}